#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int MAXN=1e6+10;
char a[MAXN];
int len,nxt[MAXN];
void cal_next()
{
	nxt[0]=-1;
	int k=-1;
	for(int i=1;i<len;++i)
	{
		while(~k&&a[k+1]!=a[i])k=nxt[k];
		if(a[k+1]==a[i])++k;
		nxt[i]=k;
	}
	return;
}
int main()
{
	while(scanf("%s",a))
	{
		if(a[0]=='.')break;
		len=strlen(a);
		cal_next();
		printf("%d\n",len%(len-nxt[len-1]-1)==0?len/(len-nxt[len-1]-1):1);
	}
	return 0;
}
